-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CDF-23593] 😃 Refactor dump method #1313
base: refactor-tool-config
Are you sure you want to change the base?
Conversation
8e4a171
to
5695239
Compare
e946591
to
c5d90f4
Compare
bccb947
to
6274a74
Compare
f5829dc
to
2cce96a
Compare
@@ -25,6 +25,7 @@ Changes are grouped as follows: | |||
### Fixed | |||
|
|||
- No more warning about missing `.env` file when running in `Google Cloud Build`. | |||
- When deploying a `Sequence` resource, Cognite Toolkit now replaces `dataSetExternalId` with `dataSetId`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found this bug in the refactoring.
@@ -82,7 +83,7 @@ def external_id( | |||
id: int | Sequence[int], | |||
) -> str | list[str]: | |||
ids = [id] if isinstance(id, int) else id | |||
missing = [id_ for id_ in ids if id not in self._reverse_cache] | |||
missing = [id_ for id_ in ids if id_ not in self._reverse_cache] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another bug introduced in last refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduced a ResourceWorker to do this. note I am not happy with the name, I think it should ideally be changed to ResourceLoader and rename the ResourceLoaders to something like StandardizedResource as this does a lot more than just loading individual files, dumping, CRUD, iteration, authorization as well.
Agree that we should rename, let's revisit later. Apart from that, great progress 🚀
Description
Changes the
ResourceLoaders
Removed the following method
Changed the signature of the following three methods
To this:
Notice that this signature has fewer arguments than the original. It simplifies the implementations, in addition, by returning the
list[dict[str, Any]]
in theload_resource_file
the methods are more flexible which means that they can be used in thecdf modules pull
command.Finally, realizes that loading from file, and figuring out what to create, update, and remain unchange, had to be done in one step, as now we dump the CDF resources into the same format as the local file.
Introduced a
ResourceWorker
to do this. note I am not happy with the name, I think it should ideally be changed toResourceLoader
and rename theResourceLoaders
to something likeStandardizedResource
as this does a lot more than just loading individual files, dumping, CRUD, iteration, authorization as well.Checklist
_version.py and
pyproject.toml per semantic versioning.